home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Resources / Burning & Media / GB-PVR 1.2.13 / GBPVR10213.msi / Cabs.w1.cab / DetailDisplay.cs32 < prev    next >
Text File  |  2007-09-08  |  5KB  |  127 lines

  1. using System;
  2. using System.Data;
  3. using System.Configuration;
  4. using System.Collections;
  5. using System.Web;
  6. using System.Web.Security;
  7. using System.Web.UI;
  8. using System.Web.UI.WebControls;
  9. using System.Web.UI.WebControls.WebParts;
  10. using System.Web.UI.HtmlControls;
  11.  
  12. using GBPVR.Public;
  13.  
  14. namespace gbweb.classes
  15. {
  16.     public class DetailDisplay
  17.     {
  18.         public static string getDetailDisplay(Programme programme)
  19.         {
  20.             string programUniqueIdentifier = programme.getUniqueProgrammeIdentifier();
  21.             string description = programme.getDescription();
  22.  
  23.             //Check to see if the user uses the ExtendedEWA Extended database
  24.             bool ExtendedEWAEnabled = ExtendedEWA.Initialize();
  25.             if (ExtendedEWAEnabled)
  26.             {
  27.                 //Open the ExtendedEWA DB
  28.                 ExtendedEWA.OpenExtendedEWADB();
  29.             }
  30.  
  31.            //Add a line break if there is a description to provide seperation space
  32.             if (description.Length > 0)
  33.             {
  34.                 description = description + "<br>";
  35.             }
  36.  
  37.             //Retrieve the rating for the show
  38.             string rating = programme.getRating();
  39.             if (rating != null && rating != "")
  40.             {
  41.                 description = description + "<br>" + "  Rated: " + programme.getRating();
  42.             }
  43.  
  44.             //Add the show Genre to the line
  45.             //set the label for the list of genre
  46.             ArrayList genreCheck = programme.getGenreList();
  47.             for (int unknownPos = genreCheck.BinarySearch("unknown", new CaseInsensitiveComparer()); unknownPos > -1;
  48.                 unknownPos = genreCheck.BinarySearch("unknown", new CaseInsensitiveComparer()))
  49.             {
  50.                 genreCheck.RemoveAt(unknownPos);
  51.             }
  52.             for (int unknownPos = genreCheck.BinarySearch(string.Empty, new CaseInsensitiveComparer()); unknownPos > -1;
  53.                 unknownPos = genreCheck.BinarySearch(string.Empty, new CaseInsensitiveComparer()))
  54.             {
  55.                 genreCheck.RemoveAt(unknownPos);
  56.             }
  57.             if (genreCheck.Count > 0)
  58.             {
  59.                 description += "<br/>Genre" + (genreCheck.Count > 1 ? "s" : string.Empty) + ": " + string.Join(", ", (string[])genreCheck.ToArray(typeof(string)));
  60.             }
  61.  
  62.             // If the user has ExtendedEWA append additional information to the description when found
  63.             if (ExtendedEWAEnabled)
  64.             {
  65.                 // Pull the Airdate of the Show or the Release Year of the movie and the Start Rating for Movie
  66.                 string[] programInfo = ExtendedEWA.GetProgramInfo(programUniqueIdentifier);
  67.  
  68.                 if (programInfo.Length > 0)
  69.                 {
  70.                     if (programUniqueIdentifier.StartsWith("MV"))
  71.                     {
  72.                         if (programInfo[0] != "0")
  73.                         {
  74.                             description += "<br> Movie Release Year: " + programInfo[0];
  75.                         }
  76.                         if (programInfo[2] != "none")
  77.                         {
  78.                             description += "<br> Star Rating: " + programInfo[2];
  79.                         }
  80.                     }
  81.                     else
  82.                     {
  83.                         if (programInfo[1] != "none")
  84.                         {
  85.                             description += "<br> Original Air Date: " + programInfo[1];
  86.                         }
  87.                     }
  88.                 }
  89.  
  90.                 //Check the ExtendedEWA supplemental database to see if the show is a new show
  91.                 if (ExtendedEWA.IsNew(programUniqueIdentifier))
  92.                 {
  93.                     //If show is a new show tag an indicator at the end of the description indicating so
  94.                     description += "<br><B>  (* New *)</B>";
  95.                 }
  96.                 //We need to check to see if the airdate is >= to today since the New show identifier is not reliable.
  97.                 //If the airdate is >= programme air date then we can assume it is a new show
  98.                 else if (programInfo.Length > 0)
  99.                 {
  100.                     if (!programUniqueIdentifier.StartsWith("MV"))
  101.                     {
  102.                         if (programInfo[1] != "none")
  103.                         {
  104.                             try
  105.                             {
  106.                                 DateTime airDate = Convert.ToDateTime(programInfo[1]);
  107.                                 if (airDate.Date >= programme.getStartTime().Date)
  108.                                 {
  109.                                     description += "<br><B>  (* New *)</B>";
  110.                                 }
  111.                             }
  112.                             catch (Exception e)
  113.                             {
  114.                             }
  115.                         }
  116.                     }
  117.                 }
  118.  
  119.                 //Close the ExtendedEWA DB
  120.                 ExtendedEWA.CloseExtendedEWADB();
  121.             }
  122.  
  123.             return description;
  124.         }
  125.     }
  126. }
  127.